﻿using System;
using System.Collections;
using System.Linq;

namespace ResumeSearch
{
    class Cldatahandler
    {
        public ArrayList GetData(string qry)
        {
            var __res = new ResumeDatabaseEntities();
            var _alist = new ArrayList();
            var __query = from item in __res.tb_resume
                          where item.rMarkerType.Contains(qry) || item.rDefinition.Contains(qry)
                          select item;

            foreach (tb_resume _item in __query)
            {
                _alist.Add(_item.rMarkerType);
                _alist.Add(_item.rDefinition);
            }

            return _alist;
        }

        public string GetGuid()
        {
            return Guid.NewGuid().ToString();
        }

        public void InsertData(string _idresume, string _marker, string _detail)
        {
            var __res = new ResumeDatabaseEntities();

            // Create a new category
            var __rtab = new tb_resume();

            __rtab.idresume = _idresume;
            __rtab.rMarkerType = _marker;
            __rtab.rDefinition = _detail;
            __rtab.rdtentered = DateTime.Now;

            __res.AddTotb_resume(__rtab);
            __res.SaveChanges();
        }
    }
}
